package com.alibaba.citrus.cr.platform.enhance.functions.item;

import com.alibaba.citrus.cr.common.util.SpringContextUtil;
import com.alibaba.citrus.cr.platform.enhance.repository.ScItemRepository;

import com.epoch.app.crplatformenhance.model.dto.ScItemSDO;
import lombok.Getter;
import lombok.Setter;

/**
 * @author zhoubc
 * @description: TODO
 * @date 2021/9/3 20:05
 */
public class ScItemEntity {

    @Getter
    @Setter
    private ScItemSDO scItemSDO;

    private static ScItemRepository scItemRepository;

    static {
        scItemRepository = SpringContextUtil.getBean(ScItemRepository.class);
    }

    public static ScItemEntity of(ScItemSDO scItemSDO) {
        ScItemEntity entity = new ScItemEntity();
        entity.setScItemSDO(scItemSDO);
        return entity;
    }

    public Boolean doCreate() {
        return scItemRepository.createScItem(scItemSDO);
    }

    public Boolean doEdit() {
        return scItemRepository.editScItem(scItemSDO);
    }

    public ScItemSDO doQueryById() {
        return scItemRepository.getScItem(scItemSDO.getScItemId());
    }
}
